<template>
	<view class="content">
		<navTop :title="navtop.title" :isHeight="false" :tipsShow="false" hasBgc="#fff" :color="navtop.color" :isBack="true" ></navTop>
		<view class="content-box" :style="{paddingTop:barHeight+'rpx'}">
		</view>
		<view class="content-body">
			<view class="content-new__item" v-for="(v, i) in newsList" :key="i" @click="gotoDetail(v)">
				<image :src="v.imgUrl"  class="content-item__img"  mode="aspectFit"></image>
				<view class="content-item__info">
					<view class="content-item__title">
						{{v.title || ''}}
					</view>
					<view class="content-item__tips">
						{{v.tips}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
import navTop from '@/components/nav-title.vue';
import iconAdd from '@/static/icon_add.png';

	export default {
		components: {
			navTop
		},
		data() {
			return {
				iconAdd,
				barHeight: 0,
				navtop: {
					title: 'Recent News',
					color: '#000'
				},
				newsList: [
				]
			}
		},
		onLoad() {

		},
		created() {
			this.isBarHeight999().then((statusBarHeight)=>{
				this.barHeight = statusBarHeight + 140
			})
		},
		onShow() {
			this.getRealtimeInfo()
		},
		methods: {
			getRealtimeInfo() {
				this.$http('get', '/app/realtimeInfo/list', {
					page: 1,
					limit: 99999
				}).then(res => {
					if (res.success) {
						res.data.forEach((v) => {
							v.tips = this.$utils.getTimerOff(v.createTime)
						})
						this.newsList = res.data
					}
				})
			},
			gotoDetail(v) {
				uni.navigateTo({
					url: `/pages/index/recentDetail?id=${v.id}`
				})
			}
		}
	}
</script>

<style lang="less">
.content {
	background-color: #FBFCFE;
	// padding: 0 30px;
	min-height: 100vh;
}
.content-box {
	font-size: 40rpx;
	font-family: Helvetica-Bold, Helvetica;
	font-weight: bold;
	color: #1F1F1F;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 34rpx;
	.content-title {
		font-size: 40rpx;
		padding: 28rpx 30rpx;
		background-color: #fff;
		width: 100%;
		box-sizing: border-box;
	}
}

.content-body{
	padding: 0 30rpx;
	margin-top: 40rpx;
	z-index: 999;
}

.content-new__item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	background-color: #fff;
	margin-bottom: 30rpx;
}
.content-item__img {
	width: 260rpx;
	height: 182rpx;
	border-radius: 10rpx;
}
.content-item__info {
	padding: 36rpx 30rpx;
	width: 500rpx;
}
.content-item__title {
	font-size: 30rpx;
	font-family: Helvetica;
	color: #1F1F1F;
	margin-bottom: 18rpx;
	text-overflow: -o-ellipsis-lastline;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}
.content-item__tips {
	font-size: 22rpx;
	font-family: Helvetica;
	color: rgba(31, 31, 31, 0.45);
	color: #1F1F1F;
}
</style>
